<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>token的读写处理</title>
  </head>
  <body></body>
  <script>
    "use strict";
    //token
    let Request = {
      set token(content) {
        localStorage.setItem("token", content);
      },
      get token() {
        let token = localStorage.getItem("token");
        if (!token) {
          alert("请登录！");
        }
        return token;
      }
    };
    Request.token = "12313701710jfiwj29";
    console.log(Request.token);
  </script>
</html>
